<?php
namespace Shopadmin\Controller;
use Think\Controller;
class IndexController extends ExtendController {
	public function logout(){
		session('[start]');
		session('[destroy]');
		$this->assign("info","成功退出！");
		$this->display("Index:login");
	}
	public function open(){
		Vendor("taobaosdk.top.request.TmcUserPermitRequest");
		session('[start]');
		$req = new \TmcUserPermitRequest;
		$req->setTopics("taobao_trade_TradeBuyerPay,taobao_trade_TradeSuccess,taobao_trade_TradeRated");
		$resp = $this->c->execute($req, session('access_token'));
		if($resp->is_success==true){
			$data["status"]=true;
		}else{
			$data["msg"]=$resp->msg.', '.$resp->sub_msg;
			$data["status"]=false;
		}
		$this->ajaxReturn($data);
	}
	public function close(){
		Vendor("taobaosdk.top.request.TmcUserCancelRequest");
		session('[start]');
		$req = new \TmcUserCancelRequest;
		$req->setNick(session("VISITOR_NICK"));
		$resp = $this->c->execute($req);
		if($resp->is_success==true){
			$data["status"]=true;
		}else{
			$data["msg"]=$resp->msg.$resp->sub_msg;
			$data["status"]=false;
		}
		$this->ajaxReturn($data);
	}
	
	public function index(){
	// 导入页
		Vendor("taobaosdk.top.request.TmcUserGetRequest");

		$CFG = M("ShopCfg");
		$row = current($CFG->where("`sid`=".session("SID"))
						   ->getField("id,curtool,
									   tms_newcomer,
									   range_time,
									   sumpay,
									   trads,
									   lotts,
									   wins,start_time,end_time,range_time,withdraw,brandid,orderset,game_lv1_times,game_lv2_times,game_lv3_times,game_def_times,goodrate_times,order_payment,order_payment_addon,order_pay_time_start,order_pay_time_end,cart_items,order_items,order_success_times,order_pay_times,tms_newcomer,tms_cartadd,tms_goodrate,tms_everyday,collect"));
		$row["order_items_count"] = $row["order_items"]?count(explode(",",$row["order_items"])):0;
		$row["cart_items_count"] = $row["cart_items"]?count(explode(",",$row["cart_items"])):0;
		$Tool = D("CheckTools");
		$tool_info = current($Tool->GetToolInfo($row["curtool"]));
		$tool_type = $tool_info["tool_type"];//echo $tool_type;
		$pic_url = $tool_info["pic_url"];
		$name = $tool_info["name"];
		$req = new \TmcUserGetRequest;
		$req->setFields("user_nick,topics,user_id,is_valid,created,modified");
		$req->setNick(session("VISITOR_NICK"));
		$resp = $this->c->execute($req);
		$status = $resp->tmc_user->topics->string;
		
		$P = M("Page");
		$info["msg"]=htmlspecialchars_decode($P->where("`id`=1")->getField("`content`"));
		$info["type"]="success";
		if($info["msg"]){
		$this->assign("info",$info);
		}
		
		$ORD = M("Orders");
		$tre = $ORD->where("type<>'0'")->order("id desc")->limit(10)->getField("id,pub_time,ts");
		foreach($tre as $k=>$v){
			$ts += strtotime($v["ts"])-strtotime($v["pub_time"]);
		}
		$this->assign("yanchi",out($ts/10)); //订单延迟程度
		$this->assign("tool_type",$tool_type);
		$this->assign("status",count($status));
		$this->assign("cfg",$row);
		$this->assign("title","系统首页");
		$this->assign("current","home");
		$this->display();
	}	

	public function gamecfg(){
	// 游戏设置
		if(!$cacheService){$cacheService = D("Home/Catche");}
		$repick = I("get.repick");
		if(!$repick){
			$CFG = M("ShopCfg");
			$curtool = $CFG->where("`sid`=".$this->sid)->getField("curtool");
			if($curtool!=""){
				$cacheService->set($this->safe."toolname",$curtool);
				$this->gamecfg_1();
				return;
			}
		}
		$Tool = D("CheckTools");
		$Tool->sid=$this->sid;
		$Tool->where="`sm_tools`.`tool_type`=1 OR `sm_tools`.`tool_type`=3";
		$tools = $Tool->ShowTools();
		$this->assign('tools',$tools);
		$this->assign('title','游戏设置');
		$this->assign("current","shopgamecfg");
		$this->display();
	}
	public function gamecfg_1(){
		if(!$cacheService){$cacheService = D("Home/Catche");}
		$toolname = I("post.toolname");
		if(!$toolname){
			$toolname = $cacheService->get($this->safe."toolname");
		}
		$Tool = D("CheckTools");
		$CFG = M("ShopCfg");
		$cfg = current($CFG->where("`sid`=".$this->sid)->getField("id,curtool,start_time,end_time,range_time,withdraw,brandid,orderset,game_lv1_times,game_lv2_times,game_lv3_times,game_def_times,goodrate_times,order_payment,order_payment_addon,order_pay_time_start,order_pay_time_end,cart_items,order_items,goodrate_kwd,order_success_times,order_pay_times,tms_newcomer,tms_cartadd,tms_goodrate,tms_everyday,collect,andor,tms_cartadd_limit"));
		$cfg["order_items_count"] = $cfg["order_items"]?count(explode(",",$cfg["order_items"])):0;
		$cfg["cart_items_count"] = $cfg["cart_items"]?count(explode(",",$cfg["cart_items"])):0;
		$cfg["cartset"] = $cfg["tms_cartadd"]==0?0:1;
		$cfg["order_payment_addon"] = $cfg["order_payment_addon"]==10000?"--":$cfg["order_payment_addon"];
		// $cfg["order_pay_time_start"] = (strtotime($cfg["order_pay_time_start"])==strtotime("2000-01-01 00:00:00"))?"":$cfg["order_pay_time_start"];
		// $cfg["order_pay_time_end"] = (strtotime($cfg["order_pay_time_end"])==strtotime("2000-01-01 00:00:00"))?"":$cfg["order_pay_time_end"];
		
		// if($cfg["order_payment"]==0&&$cfg["order_success_times"]==0&&$cfg["order_pay_times"]==0){
			// $cfg["orderset"]=0;
		// }else{
			// $cfg["orderset"]=1;
		// }
		if(!$Tool->myfilter($toolname)){
			$this->success("您没有选择游戏类型！","/?a=gamecfg&m=shopadmin");
			return;
		}else{
			$Tool->ToolName = $toolname;
			$Tool->sid = $this->sid;
			if(!$Tool->CheckToolStatus()){
				$CFG->where("`sid`=".$this->sid)->setField("curtool","");
				$cacheService->delete($this->safe."toolname");
				$this->success("抱歉，您选择的游戏类型没有开通！","/?a=gamecfg&m=shopadmin");
				return;
			}else{
				$tool_info = current($Tool->GetToolInfo($toolname));
				$tool_type = $tool_info["tool_type"];//echo $tool_type;
				$pic_url = $tool_info["pic_url"];
				$name = $tool_info["name"];
				$cacheService->set($this->safe."toolname",$toolname);
				session('[start]');
				session("curtool",$toolname);
			}
		}
		
		$this->assign('cfg',$cfg);
		$this->assign('name',$name);
		$this->assign('tooltype',$tool_type);
		$this->assign('pic_url',$pic_url);
		$this->assign('title','游戏设置');
		$this->assign("current","shopgamecfg");
		$this->display("gamecfg_1");
	}
	public function gamecfg_save(){
		$Tool = D("CheckTools");
		session('[start]');
		$toolname = session("curtool");
		$tool_id = $Tool->GetToolID($toolname);
		$tool_type = $Tool->GetToolType($toolname);
		
		$data["sid"] = $this->sid;
		$data["curtool"] = $toolname;
		$data["game_lv1_times"] = I("post.game_lv1_times");
		$data["game_lv2_times"] = I("post.game_lv2_times");
		$data["game_lv3_times"] = I("post.game_lv3_times");
		$data["game_def_times"] = I("post.game_def_times");
		$data["range_time"] = I("post.range_time");
		$data["start_time"] = I("post.start_time");
		$data["end_time"] = I("post.end_time");
		$data["withdraw"] = I("post.with_draw_time");
		$data["tms_newcomer"] = I("post.tms_newcomer");
		$data["likeme"] = I("post.like")?1:0;
		$data["collect"] = I("post.collect")?1:0;
		$data["followme"] = I("post.follow")?1:0;
		$data["sumpay"] = I("post.lj_money");
		$data["advancedset"] = I("post.advancedset");
		$data["taobao_user_id"] = session("VISITOR_ID");
		$data["usernick"] = session("VISITOR_NICK");
		$data["refresh_token"] = session("refresh_token");
		$data["sessionkey"] = session("access_token");
		$data["logintime"] = session("logintime")?session("logintime"):date("Y-m-d H:i:s");
		I("post.ostart_time")?$data["order_starttime"] = I("post.ostart_time"):"";
		I("post.oend_time")?$data["order_endtime"] = I("post.oend_time"):"";
		I("post.ordertimeset")?$data["order_timeset"] = I("post.ordertimeset"):"";
		I("post.brandme")?$data["brandid"] = I("post.brandid"):$data["brandid"]=0;
		I("post.tms_everyday")?$data["tms_everyday"] = I("post.tms_everyday"):$data["tms_everyday"]=0;
		I("post.andor")=="or"?$data["andor"] = 1:$data["andor"]=0;
		$data["orderset"] = I("post.orderset");
		$data["cart_items"] = I("post.cart_items");
		$data["tms_cartadd"] = I("post.tms_cartadd");
		$data["tms_cartadd_limit"] = I("post.tms_cartadd_limit");
		if($data["cart_items"]){
			Vendor('taobaosdk.top.request.ItemsSellerListGetRequest');
			$req = new \ItemsSellerListGetRequest;
			$req->setFields("pic_url");
			$req->setNumIids($data["cart_items"]);
			$resp = $this->c->execute($req, session("access_token"));
			foreach($resp->items->item as $item){
				$pic_urls[]=$item->pic_url;
			}
			$data["cart_items_pics"]=(implode(",",$pic_urls));
		}
		if(I("post.orderset")==1){
			if(I("post.order_payment_overamont")=="--"){
			$data["order_payment_addon"]=10000;
			}else{
			$data["order_payment_addon"] = I("post.order_payment_overamont");
			}
			$data["order_items"]=I("post.order_items");
			$data["tms_goodrate"]=I("post.tms_goodrate");
			I("post.order_pay_time_start")?$data["order_pay_time_start"]=I("post.order_pay_time_start"):"";
			I("post.order_pay_time_end")?$data["order_pay_time_end"]=I("post.order_pay_time_end"):"";
			$data["order_pay_times"]=I("post.order_pay_times");
			$data["order_success_times"]=I("post.order_success_times");
			$data["order_payment"] = I("post.order_payment");
			$data["order_success_times"] = I("post.order_success_times");
			$data["order_pay_times"] = I("post.order_pay_times");
			$data["goodrate_times"] = I("post.goodrate_times")?I("post.goodrate_times"):0;
			$data["goodrate_kwd"] = I("post.goodrate_kwd");
		}
		if(I("post.custom")=="newcomer"){
			$data["trads"] = 0;
		}
		if(I("post.custom")=="oldcomer"){
			$data["trads"] = 1;
		}
		if(I("post.custom")=="chkjy"){
			$data["trads"] = I("post.jy_tms");
		}
		if(I("post.rate")=="no_bad"){
			$data["goodrates"] = 0;
		}
		if(I("post.rate")=="all_good"){
			$data["goodrates"] = 1;
		}
		if(I("post.no_refond")){
			$data["norefound"] = 1;
		}
		$data["everytrades"] = I("post.everytrades")?I("post.everytrades"):0;
		$data["everytrades_times"] = I("post.everytrades_times")?I("post.everytrades_times"):0;
		$data["everysumpay"] = I("post.everysumpay")?I("post.everysumpay"):0;
		$data["everysumpay_times"] = I("post.everysumpay_times")?I("post.everysumpay_times"):0;
// print_r($data);return;
		$CFG = M("ShopCfg");
		if(!$CFG->where("`sid`=".$this->sid)->getField("id")){
			$data["jointime"] = date("Y-m-d H:i:s");
			$re = $CFG->add($data);
		}else{
			$re = $CFG->where("`sid`=".$this->sid)->save($data);
		}
		$this->assign('title','游戏设置');
		$this->assign("current","shopgamecfg");
		if($re){
		$this->success("设置完成！","/?a=gamecfg&m=shopadmin");
		}else{
			$this->assign("message","您可能未做任何更改");
			echo $CFG->getDbError();
		$this->error("设置失败！","/?a=gamecfg&m=shopadmin");
		}
	}
	public function gamegg_save(){
		I("post.notice")?$data["notice"] = I("post.notice"):"";
		I("post.notice_rule")?$data["notice_rule"] = I("post.notice_rule"):"";
		I("post.notice_receive")?$data["notice_receive"] = I("post.notice_receive"):"";
		if($data){
			$CFG = M("ShopCfg");
			$cfg = $CFG->where("`sid`=".session("SID"))->getField("`id`");
			if($cfg){
				$re = $CFG->where("`sid`=".session("SID"))->save($data);
				if($re){
					$this->success("设置完成！","/?a=gamegg&m=shopadmin");
				}else{
					$this->success("设置失败，请先配置活动","/?a=gamecfg&m=shopadmin");
				}
			}else{
				$this->success("设置失败，请先配置活动","/?a=gamecfg&m=shopadmin");
			}
		}else{
			$this->success("设置失败，请输入公告内容！","/?a=gamegg&m=shopadmin");
		}
	}
	public function gamegg(){
	// 公告设置
		$auto = I("get.auto");
		$CFG = M("ShopCfg");
		if(!$auto){
			$row = current($CFG->where("`sid`=".session("SID"))->getField("id,notice,notice_rule,notice_receive"));
			if($row["notice"]==""&&$row["notice_rule"]&&$row["notice_receive"]){
				$auto = true;
			}
		}
		if($auto){
			$row = current($CFG->where("`sid`=".session("SID"))
							   ->getField("id,curtool,
									   tms_newcomer,
									   range_time,
									   sumpay,
									   trads,
									   lotts,
									   withdraw,
									   wins,start_time,end_time,range_time,withdraw,brandid,orderset,game_lv1_times,game_lv2_times,game_lv3_times,game_def_times,goodrate_times,order_payment,order_payment_addon,order_pay_time_start,order_pay_time_end,cart_items,order_items,order_success_times,order_pay_times,tms_newcomer,tms_cartadd,tms_goodrate,tms_everyday,collect"));
			if($row["order_payment"]==0&&$row["order_success_times"]==0&&$row["order_pay_times"]==0){
				$row["orderset"]=0;
			}else{
				$row["orderset"]=1;
			}
			switch($row["withdraw"]){
				case 0 :$row["withdraw"]="一直可以领奖";break;
				case 1 :$row["withdraw"]="一周以内领奖";break;
				case 2 :$row["withdraw"]="二周以内领奖";break;
				case 3 :$row["withdraw"]="三周以内领奖";break;
				case 4 :$row["withdraw"]="四周以内领奖";break;
			}
		}
		$G = M("EventsGifts");
		$gft = current($G->where("`sid`=".session("SID"))->getField("id,SUM(price) AS PR,SUM(probability) AS PB"));
		$gft["PB"]=$gft["PB"]/100;
		$this->assign("gft",$gft);
		$this->assign("cfg",$row);
		$this->assign("title","公告设置");
		$this->assign("current","shopgamegg");
		$this->display();
	}
	public function gamewg_save_kg(){
		echo "功能已转移";
		$data["front_pic"]=I("get.status");
		$CFG = M("ShopCfg");
		$data["status"] = $CFG->where("`sid`=".$this->sid)->save($data);
		$this->ajaxReturn($data);
	}
	public function gamewg_save(){
		echo "功能已转移";
		// $data["front_pic_url"]=I("post.urls");
		// $data["front_cfg"]=I("post.code");
		// $CFG = M("ShopCfg");
		// $re = $CFG->where("`sid`=".$this->sid)->save($data);
		// if($re){
			// $this->success("保存成功！","/?a=gamewg&m=shopadmin");
		// }else{
			// // echo $CFG->getDbError();
			// $this->assign("message","请检查以下项目：<br>1.请确认您配置过活动，只有先配置活动，才可以自定义图片。<br />2.您没有重新上传文件，仍然使用原来的图片。");
			// $this->error("保存失败！","/?a=gamewg&m=shopadmin");
		// }
	}
	public function gamewg(){
	// 公告设置
	echo '设置已转移！';
		// $CFG = M("ShopCfg");
		// $cfg = current($CFG->where("`sid`=".$this->sid)->getField("curtool,front_pic,front_pic_url,front_cfg"));
		// if(!$cfg){
			// $this->error("您尚未配置活动，请先配置活动再设置外观！","/?a=gamecfg&m=shopadmin");
		// }
		// $bg_own = $cfg["front_pic_url"];
		// switch($cfg["curtool"]){
			// case "eggs" :
			// $default_cfg["contdown"]["top"]="128";
			// $default_cfg["contdown"]["left"]="11";
			// $default_cfg["action"]["background"]="http://img02.taobaocdn.com/imgextra/i2/27390555/TB2QP30bpXXXXaXXpXXXXXXXXXX-27390555.png";
			// $default_cfg["action"]["width"]="189";
			// $default_cfg["action"]["height"]="303";
			// $default_cfg["action"]["left"]="382";
			// $default_cfg["action"]["top"]="20";
			// $bg = "http://img01.taobaocdn.com/imgextra/i1/27390555/TB2p0vwaVXXXXcVXXXXXXXXXXXX-27390555.jpg";
			// break;
			// case "chest" :
			// $bg = "http://img02.taobaocdn.com/imgextra/i2/27390555/TB2V81oaVXXXXcMXXXXXXXXXXXX-27390555.jpg";
			// break;
			// case "wheels" :
			// $bg = "http://img04.taobaocdn.com/imgextra/i4/27390555/TB2YXhPaVXXXXcXXXXXXXXXXXXX-27390555.jpg";
			// break;
			// case "dices":
			// $default_cfg["contdown"]["top"]="148";
			// $default_cfg["contdown"]["left"]="5";
			// $default_cfg["action"]["background"]="http://img02.taobaocdn.com/imgextra/i2/27390555/TB2WhpOaXXXXXcTXXXXXXXXXXXX-27390555.png";
			// $default_cfg["action"]["width"]="100";
			// $default_cfg["action"]["height"]="100";
			// $default_cfg["action"]["left"]="415";
			// $default_cfg["action"]["top"]="118";
			// $bg = "http://img03.taobaocdn.com/imgextra/i3/27390555/TB22sOiaVXXXXb1XXXXXXXXXXXX-27390555.jpg";
			// break;
			// case "scratchcards":
			// $bg = "http://img04.taobaocdn.com/imgextra/i4/27390555/TB2wTmhaVXXXXcJXXXXXXXXXXXX-27390555.jpg";
			// break;
			// case "fruit":
			// $bg = "http://img03.taobaocdn.com/imgextra/i3/27390555/TB25v1paVXXXXcSXXXXXXXXXXXX-27390555.jpg";
			// break;
			// case "miao":
			// $bg = "http://img04.taobaocdn.com/imgextra/i4/27390555/TB2Rw40apXXXXbjXXXXXXXXXXXX-27390555.jpg";
			// break;
		// }
		// $front_cfg = json_decode(htmlspecialchars_decode($cfg["front_cfg"]),true);
		// $front_cfg["action"]["background"]=str_replace(") no-repeat","",str_replace("url(","",$front_cfg["action"]["background"]));
		// $front_cfg["cart"]["background"]=str_replace(") no-repeat","",str_replace("url(","",$front_cfg["cart"]["background"]));
		// $this->assign("default_cfg",$default_cfg);
		// $this->assign("front_cfg",$front_cfg);
		// $this->assign("curtool",$cfg["curtool"]);
		// $this->assign("bg",$bg);
		// $this->assign("bg_own",$bg_own);
		// $this->assign("bg_open",$cfg["front_pic"]);
		// $this->assign("title","外观设置");
		// $this->assign("current","waiguan");
		// $this->display();
	}
	public function gamescore(){
		$usernick = I("post.usernick");
		if($usernick){
			$where=" AND `sm_user`.`usernick`='".$usernick."'";
		}
		Vendor('Page');
		$SCORE = M("GameScore");
		$total = $SCORE->where("`sm_game_score`.`sid`=".$this->sid.$where)->getField("count(`sm_game_score`.`id`)");
		$Page = new \Page($total,$this->listRows);
		$Page->rollPage=$this->rollPage;
		$show = $Page->show();
		$data = $SCORE->where("`sm_game_score`.`sid`=".$this->sid.$where)
					  ->join("LEFT JOIN `sm_shop_users` ON `sm_shop_users`.`id`=`sm_game_score`.`shopuid`")
					  ->join("LEFT JOIN `sm_user` ON `sm_user`.`id`=`sm_shop_users`.`userid`")
					  ->limit($Page->firstRow.','.$Page->listRows)
					  ->order("`sm_game_score`.`id` DESC")
					  ->getField("
						  `sm_game_score`.`id`,
						  `sm_game_score`.`shopuid`,
						  `sm_game_score`.`top_parameters`,
						  `sm_game_score`.`top_sign`,
						  `sm_game_score`.`score`,
						  `sm_game_score`.`lotts`,
						  `sm_game_score`.`range_level`,
						  `sm_game_score`.`game_name`,
						  `sm_game_score`.`start_time`,
						  `sm_game_score`.`end_time`,
						  `sm_game_score`.`level`,
						  `sm_game_score`.`status`,
						  `sm_game_score`.`sys_score`,
						  `sm_game_score`.`time_round`,
						  `sm_user`.`usernick`
						  ");
		foreach($data as $k=>$v){
			$data[$k]["yanz"] = ($v["top_sign"]==base64_encode(md5(C("SM_KEY").$k["top_parameters"].C("SM_SECRET"),true)))?"成功":"失败";
			if($data[$k]["status"]==1){
				$data[$k]["status"]="未抽奖";
			}else{
				$data[$k]["status"]="已抽奖";
			}
		}
		$info["type"]="info";
		$info["msg"]="注意，只有抽过奖的玩家才知道他的用户名";
		$this->assign("info",$info);
		$this->assign("title","游戏成绩");
		$this->assign("data",$data);
		$this->assign("page",$show);
		$this->assign("search",$usernick);
		$this->assign("current","gamescore");
		$this->display("gamescore");
	}
	public function assigntool(){
		$toolname = I("get.toolname");
		$lowversion = I("get.lowversion");
		$Chk = D("CheckTools");
		if($Chk->myfilter($toolname)){
			$tool_type = $Chk->GetToolType($toolname);
			$Chk->UserNick = $this->usernick;
			$Chk->IsvCode = C("SM_CODE");
			$Chk->CheckISV();
			// $Chk->item_code=C("SM_CODE").'-2';
			// $Chk->deadline="2016-03-12 19:00:00";
			if($Chk->item_code==C("SM_CODE").'-2' ){
				if($tool_type==3||$tool_type==1){
					$Chk->sid=$this->sid;
					$Chk->toolid=$Chk->GetToolID($toolname);
					$Chk->lowversion=$lowversion?true:false;
					if($Chk->AssignTool()){
						$data['status']=true;
						$data['msg']='成功开通！';
					}else{
						$data['status']=false;
						$data['msg']="err".$Chk->err;
					}
				}else{
					$data['status']=false;
					$data['msg']='未知的工具类型';
				}
			}elseif($Chk->item_code==C("SM_CODE").'-1'){
				// if($tool_type ==1){  暂取消版本判断
					// 判断版本类型，普及版所有用户可开通。-1为普通版，-2为游戏版/风尚版
					$Chk->sid=$this->sid;
					$Chk->toolid=$Chk->GetToolID($toolname);
					if($Chk->AssignTool()){
						$data['status']=true;
						$data['msg']='成功开通！';
					}else{
						$data['status']=false;
						$data['msg']='err-1'.$Chk->err;
					}
				// }else{
					// $data['status']=false;
					// $data['msg']='您尚未订购游戏版，仅游戏版可开通本工具。<a class="button" href="http://fuwu.taobao.com/service/service.htm?service_code=ts-30901&f=upgrad" target="_blank" >立即订购</button><a href=""></a>';
				// }
			}
		}else{
			$data['status']=false;
			$data['msg']='您要开通的工具不存在';
		}
		$this->ajaxReturn($data);
	}
	public function imgupload(){
	
		// 本地环境上传
		$img = D("ImgUpload");
		$img->sessionKey=session("access_token");
		$img->imgPath=$_FILES['Filedata']["tmp_name"];   //本地环境测试通过
		$img->upload();
		if(!$img->err){
			$data["status"]=1;
			$data["type"]="ajax";
			$data["name"]="@_FILES['userfile']";
			$data["url"]=$img->pic_url;
		}else{
			$data["status"]=1;
			$data["message"]=$img->err;
		}
		$this->ajaxReturn($data);
	}
	
}